//
//  SpielCounter.m
//  Lextra Junior ueb IT
//
//  Created by Dirk Lieder on 30.05.11.
//  Copyright 2011 Phosphon. All rights reserved.
//

#import "SpielCounter.h"

@implementation SpielCounter

@synthesize myCounter;


- (void)setDelegate:(id)new_delegate{
    Delegate = new_delegate;
    
    myCounter.text = @"";
}

- (void)setTicks:(int)sender {
    
    
    int left = floor(sender/100);
    int right = sender-left*100;
    
    NSString* strOut;
    if(sender>15){
        strOut = [NSString stringWithFormat:@"%02d:%02d", left,right];
    } else {
        strOut = @"";
    }
    myCounter.text = strOut;
    
}

- (void)setSeconds:(int)sender {
    
    
    int left = floor(sender/60);
    int right = sender-left*60;
    
    NSString* strOut;
    if(sender>0){
        strOut = [NSString stringWithFormat:@"%02d:%02d", left,right];
    } else {
        strOut = @"";
    }
    myCounter.text = strOut;
    
}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


- (void)dealloc
{
    //[bigScrollView release];
    
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
    {
        return YES;
    }
    else
    {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
}

@end
